package cn.lijida.weiwei.favor.commons.utils;

import java.io.Serializable;

/**  
* <p>Title: ReturnT</p>  
* <p>Description: 返回数据</p>  
* @author weiwei  
* @date 2019年12月28日  
*/  
public class ReturnT<T> implements Serializable {
	
	public static final long serialVersionUID = 42L;

	public static final int SUCCESS_CODE = 200;
	
	public static final int FAIL_CODE = 500;
	
	public static final int NOT_LOGIN_CODE = 506;
	
	public static final String NOT_LOGIN_MSG = "登录信息失效";
	
	public static final ReturnT<String> SUCCESS = new ReturnT<String>(null);
	
	public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null);
	
	public static final ReturnT<String> NOT_LOGIN = new ReturnT<String>(NOT_LOGIN_CODE, NOT_LOGIN_MSG);
	
	private int code;
	private String msg;
	private T data;
	
	public ReturnT(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	public ReturnT(T data) {
		this.code = SUCCESS_CODE;
		this.data = data;
	}
	
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}

}
